/*
 * @Author: ZhanXie
 * @Date: 2020-05-19 16:48:09
 * @LastEditors: ZhanXie
 * @LastEditTime: 2020-05-20 11:21:57
 * @Description:
 * @FilePath: /webpack-cli/src/sagas/countSaga.js
 */


import {
  put, takeEvery, delay, all, fork,
} from 'redux-saga/effects';

import { INCREMENT_ASYNC, INCREMENT } from '../actions/actionType';

export function* incrementAsync() {
  yield delay(1000);
  yield put({ type: INCREMENT });
}

export default function* watchIncrementAsync() {
  yield takeEvery(INCREMENT_ASYNC, incrementAsync);
}

export function* watchCount() {
  yield all([
    fork(watchIncrementAsync),
  ]);
}
